package com.neu.wms.service.impl;

import com.neu.wms.dto.RoleDto;
import com.neu.wms.dto.RoleDtoFengSir;
import com.neu.wms.entity.SysRole;
import com.neu.wms.mapper.SysRoleMapper;
import com.neu.wms.service.RoleService;
import com.neu.wms.vo.RoleVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author ：fengSir
 * @date ：Created By 2023-06-27 14:43
 * @description ：TODO
 */
@Service
public class RoleServiceImpl implements RoleService {
    @Autowired
    private SysRoleMapper sysRoleMapper;
    @Override
    public List<SysRole> selectAll() {
        return sysRoleMapper.selectAll();
    }

    @Override
    public Integer[] selectRoleIdByUid(Integer uid) {
        return sysRoleMapper.selectRoleIdByUid(uid);
    }

    @Override
    public List<RoleVo> selectAll(RoleDto roleDto) {
        return sysRoleMapper.selectAll(roleDto);
    }

    @Override
    public int insertSelective(SysRole role) {

        return sysRoleMapper.insertSelective(role);
    }

    @Override
    public SysRole queryById(Integer uid) {
        return sysRoleMapper.queryById(uid);
    }

    @Override
    public int updateByPrimaryKeySelective(SysRole role) {
        return sysRoleMapper.updateByPrimaryKeySelective(role);
    }

    @Override
    public int deleteByPrimaryKey(Long id) {
        return sysRoleMapper.deleteByPrimaryKey(id);
    }

    @Override
    public void insertRole(RoleDtoFengSir roleDto) {
        //先执行删除
        sysRoleMapper.deleteByUid(roleDto.getUid());
        //再执行插入操作
        sysRoleMapper.insertRole(roleDto);

    }
}
